|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectcontrolP5.ControllerGroup
controlP5.Textarea
public class Textarea
/**
* ControlP5 TextArea.
*
* by andreas schlegel, 2009
*/
import controlP5.*;
ControlP5 controlP5;
Textarea myTextarea;
void setup() {
size(400,400);
frameRate(30);
controlP5 = new ControlP5(this);
myTextarea = controlP5.addTextarea(
"label1",
"a textarea is of type group, not controller.\n"+
"you can set the width and height of a textarea, if there is more text than space available, scrollbars are added. "+
"use ALT + mouseDown to move the textarea. First sketches showing the potential of the new volumetric brush (here the box version was used). Size and density and brush mode (additve, multiply or replace) can be customized. Here I first used a massive brush size with high positive density to create the box, then switched to negative density and smaller size to carve out. The colours are visualizing curvature and were applied in Meshlab later.",
100,100,200,60);
controlP5.addSlider("changeWidth",0,200,100,100,20,100,9);
controlP5.addSlider("changeHeight",0,200,100,100,60,100,9);
myTextarea.setColorForeground(0xffff0000);
}
void keyPressed() {
if(key=='r') {
myTextarea.setText("a textarea can be used to leave notes inside of controlP5 displayed on the screen. scrollbars are available when text extends the visible area. Textarea extends ControllerGroup, for more available methods see the ControllerGroup documentation.");
} else if(key=='c') {
myTextarea.setColor(0xff0000);
}
}
void draw() {
background(0);
if(keyPressed && key==' ') {
myTextarea.scroll((float)mouseX/(float)width);
}
if(keyPressed && key=='l') {
myTextarea.setLineHeight(mouseY);
}
}
void changeWidth(int theValue) {
myTextarea.setWidth(theValue);
}
void changeHeight(int theValue) {
myTextarea.setHeight(theValue);
}
| Field Summary |
|---|
| Fields inherited from interface controlP5.ControlP5Constants |
|---|
acceptClassList, ACTIVE, ALT, ARC, ARRAY, BACKSPACE, BOOLEAN, BOTTOM, CENTER, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IMAGE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LINE, LOAD, MENU, METHOD, MOVE, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, SAVE, SHIFT, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TWO_PI, UP, VERBOSE, VERTICAL |
| Constructor Summary | |
|---|---|
Textarea(ControlP5 theControlP5,
ControllerGroup theGroup,
java.lang.String theName,
java.lang.String theText,
int theX,
int theY,
int theW,
int theH)
|
|
Textarea(java.lang.String theText,
int theX,
int theY)
|
|
| Method Summary | |
|---|---|
void |
addToXMLElement(ControlP5XMLElement theElement)
|
void |
controlEvent(ControlEvent theEvent)
ControlListener is an interface that can be implemented by a custom class. |
void |
disableColorBackground()
|
void |
enableColorBackground()
|
void |
hideScrollbar()
|
boolean |
isScrollbarVisible()
|
void |
scroll(float theValue)
scroll the Textarea remotely. |
void |
setColor(int theColor)
set the text color of the textarea. |
void |
setColorBackground(int theColor)
set the background color of the group. |
Textarea |
setHeight(int theValue)
set the height of the textarea. |
void |
setLineHeight(int theLineHeight)
set the lineheight of the textarea. |
void |
setPosition(float theX,
float theY)
set the position of the textarea. |
void |
setText(java.lang.String theText)
set the text of the textarea. |
Textarea |
setWidth(int theValue)
set the width of the textarea. |
void |
showScrollbar()
|
java.lang.String |
stringValue()
returns the content of the textarea's label. |
java.lang.String |
text()
returns the text content of the textarea . |
float |
value()
!!! experimental, have to check if this spoils anything. |
Label |
valueLabel()
returns the instance of the textarea's label. |
| Methods inherited from class controlP5.ControllerGroup |
|---|
absolutePosition, add, addCanvas, addDrawable, arrayValue, captionLabel, close, color, continuousUpdateEvents, controller, disableCollapse, draw, enableCollapse, getAsXML, getColor, getHeight, getPickingColor, getTab, getWidth, getWindow, hide, id, init, isCollapse, isMoveable, isOpen, isUpdate, isVisible, isXMLsavable, keyEvent, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, name, open, parent, position, remove, remove, remove, removeCanvas, setColorActive, setColorForeground, setColorLabel, setColorValue, setGroup, setGroup, setId, setLabel, setMousePressed, setMoveable, setOpen, setTab, setTab, setTab, setUpdate, setVisible, show, toString, update, updateAbsolutePosition, updateEvents, updateInternalEvents |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Textarea(ControlP5 theControlP5,
ControllerGroup theGroup,
java.lang.String theName,
java.lang.String theText,
int theX,
int theY,
int theW,
int theH)
theControlP5 - ControlP5theGroup - ControllerGrouptheName - StringtheText - StringtheX - inttheY - inttheW - inttheH - int
public Textarea(java.lang.String theText,
int theX,
int theY)
theText - StringtheX - inttheY - int| Method Detail |
|---|
public void controlEvent(ControlEvent theEvent)
ControlListener
controlEvent in interface ControlListenertheEvent - ControlEventpublic void hideScrollbar()
public void showScrollbar()
public boolean isScrollbarVisible()
public void setColorBackground(int theColor)
ControllerGroup
setColorBackground in interface ControllerInterfacesetColorBackground in class ControllerGrouptheColor - intpublic void disableColorBackground()
public void enableColorBackground()
public void scroll(float theValue)
theValue - public Textarea setWidth(int theValue)
setWidth in class ControllerGrouptheValue - intpublic Textarea setHeight(int theValue)
setHeight in class ControllerGrouptheValue - intpublic void setLineHeight(int theLineHeight)
theLineHeight - intpublic void setColor(int theColor)
theColor - intpublic Label valueLabel()
valueLabel in class ControllerGrouppublic void setText(java.lang.String theText)
theText - String
public void setPosition(float theX,
float theY)
setPosition in interface ControllerInterfacesetPosition in class ControllerGrouptheX - floattheY - floatpublic void addToXMLElement(ControlP5XMLElement theElement)
addToXMLElement in interface ControllerInterfacetheElement - ControlP5XMLElementpublic java.lang.String stringValue()
stringValue in interface ControllerInterfacestringValue in class ControllerGrouppublic java.lang.String text()
public float value()
ControllerGroup
value in interface ControllerInterfacevalue in class ControllerGroup
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||